import { useLoginStore } from '@/stores/login/index'

/**
 * 判断用户所拥有的按钮权限
 * @param permissionStr 所拥有的权限字段
 * @return boolean
 */
function usePermissions(permissionStr: string): boolean {
  const loginStore = useLoginStore()
  const { permissions } = loginStore

  return Boolean(permissions.find((item) => item.includes(permissionStr)))
}

export default usePermissions
